package com.wxn.learncompose.pagers

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.Send
import androidx.compose.material.icons.filled.Share
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp


@Composable
fun RowCardPager(){
    Surface(
        modifier = Modifier
            .fillMaxWidth()
            .padding(horizontal = 12.dp), // 设置 Surface 的外边距
        shape = RoundedCornerShape(6.dp),
        shadowElevation = 8.dp
    ) {
        Column(
            modifier = Modifier
                .fillMaxWidth()
                .padding(12.dp) // 里面内容的外边距
        ) {
            Text(text = "what's Jetpack Compose?",
                style = MaterialTheme.typography.titleMedium)
            Spacer(
                modifier = Modifier.height(6.dp)
            )
            Text(text = "Jetpack Compose 是用于构建原生 Android 界面的新工具包。它可简化并加快 Android 上的界面开发，使用更少的代码、强大的工具和直观的 Kotlin API，快速让应用生动而精彩。",
                style = MaterialTheme.typography.bodyMedium)
            Spacer(modifier = Modifier.height(6.dp))

            Row( modifier = Modifier.fillMaxWidth(),
                verticalAlignment = Alignment.CenterVertically,
//                horizontalArrangement = Arrangement.SpaceBetween
//                horizontalArrangement = Arrangement.SpaceAround
//                horizontalArrangement = Arrangement.SpaceEvenly
//                horizontalArrangement = Arrangement.Start
                horizontalArrangement = Arrangement.End
            ) {

                IconButton(onClick = {
//                    Toast.makeText(LocalContext.current.applicationContext, "favorite", Toast.LENGTH_SHORT).show()
                }) {
                    Icon(Icons.Filled.Favorite,
                        tint = Color(0xFF3399EE),
                        contentDescription = "favorite",
                        modifier = Modifier.size(28.dp))
                }

                IconButton(onClick = {
//                    Toast.makeText(LocalContext.current.applicationContext, "favorite", Toast.LENGTH_SHORT).show()
                }) {
                    Icon(Icons.Filled.Send,
                        tint = Color(0xFFEE9933),
                        contentDescription = "favorite",
                        modifier = Modifier.size(28.dp))
                }

                IconButton(onClick = {
//                    Toast.makeText(LocalContext.current.applicationContext, "favorite", Toast.LENGTH_SHORT).show()
                }) {
                    Icon(Icons.Filled.Share,
                        tint = Color(0xFFEE3399),
                        contentDescription = "favorite",
                        modifier = Modifier.size(28.dp))
                }

            }
        }

    }


}

@Preview
@Composable fun PreviewRowCardPager(){
    RowCardPager()
}